<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@page import="Dao.*"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="Entity.*"%>
<%@page import="javax.servlet.http.HttpSession"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>管理员界面</title>
</head>
<body>

	<jsp:useBean id="StudentsInformationDao"
		class="Dao.StudentsInformationDao"></jsp:useBean>
	<!-- <link href="css/administratorPage.css" rel="stylesheet" type='text/css' /> -->
	<link rel="stylesheet" href="<%=request.getContextPath() %>/css/administratorPage.css" type="text/css"></link>
	<div class="header">
		<font size='6' color="#000088"><br />&emsp;&emsp;&emsp;后台管理</font>
	</div>
	<div class="body">
		<form action="" method="post" name="admin_students_form">
			<div class="body-left">
				<div class="leftMenu">
					<ul>
						<li><a href="../" style="text-decoration: none"><font
								size="5" color="#000088">用户信息管理</font></a>
							<ul>
								<li><a href="/UniversityResourceSystem/StudentsInformationPageServlet?status=student&&opttype=queryAll" target="_blank"
									style="text-decoration: none"><font size="3" color="blue">学生</font></a></li>
								<li><a href="/UniversityResourceSystem/TeachersInformationPageServlet?status=teacher&&opttype=queryAll" target="_blank"
									style="text-decoration: none"><font size="3" color="blue">教师</font></a></li>
							</ul></li>
					</ul>
					<ul>
						<li><a href="../" style="text-decoration: none;"><font
								size="5" color="#000088">资源管理</font></a>
							<ul>
								<li><a href="showAllExcellentCourse.jsp" style="text-decoration: none"><font
										size="3" color="blue">精品课程</font></a></li>
								<li><a href="showAllLearningResource.jsp" style="text-decoration: none"><font
										size="3" color="blue">学习论坛</font></a></li>
							</ul></li>
					</ul>
				</div>
			</div>
		</form>
		<%-- <%
			if (request.getParameter("status") != null) {
				String status = request.getParameter("status");
				if (status.equals("student")) {
					List<Student> allStudentsList = new StudentsInformationDao().showAllStudents();
					session.setAttribute("session_allStudents", allStudentsList);
				}
			}
			if (session.getAttribute("session_allStudents") != null) {
				int totalRecord = StudentsInformationDao.queryRecordCount();
				out.print("<table border='1' align='center'>");
				out.print("<tr>");
				out.print("<td align='center'>" + "学号" + "</td>");
				out.print("<td align='center'>" + "姓名" + "</td>");
				out.print("<td align='center'>" + "性别" + "</td>");
				out.print("<td align='center'>" + "学院" + "</td>");
				out.print("<td align='center'>" + "专业" + "</td>");
				out.print("<td align='center'>" + "班级" + "</td>");
				out.print("<td align='center'>" + "身份证号" + "</td>");
				out.print("<td align='center'>" + "密码" + "</td>");
				out.print("<td align='center'>" + "电话" + "</td>");
				out.print("</tr>");
			
				List<Student> allStudentsList = (List) session.getAttribute("session_allStudents");
				for (int i = 0; i < totalRecord; i++) {
					out.print("<tr>");
					out.print("<td align='center'>" + allStudentsList.get(i).getStudentNo() + "</td>");
					out.print("<td align='center'>" + allStudentsList.get(i).getStudentName() + "</td>");
					out.print("<td align='center'>" + allStudentsList.get(i).getSex() + "</td>");
					out.print("<td align='center'>" + allStudentsList.get(i).getDept() + "</td>");
					out.print("<td align='center'>" + allStudentsList.get(i).getMajor() + "</td>");
					out.print("<td align='center'>" + allStudentsList.get(i).getStudentClass() + "</td>");
					out.print("<td align='center'>" + allStudentsList.get(i).getStudentId() + "</td>");
					out.print("<td align='center'>" + allStudentsList.get(i).getPwd() + "</td>");
					out.print("<td align='center'>" + allStudentsList.get(i).getTel() + "</td>");
					out.print("</tr>");
				}
				out.print("<tr>");
				out.print("<td align='center' colspan='9'");
				out.print(request.getAttribute("bar"));
				out.print("</td>");
				out.print("</tr>");
				session.removeAttribute("session_allStudents");
			}
			session.removeAttribute("session_allStudents");
			out.print("</table>");
		%> --%>
		<%-- <%out.print("<div class='body-right'>");
	out.print("<table border='1'>");
	out.print("<tr>");
	out.print("<td>"+"学号"+"</td>");
	out.print("<td>"+"姓名"+"</td>");
	out.print("<td>"+"性别"+"</td>");
	out.print("<td>"+"学院"+"</td>");
	out.print("<td>"+"专业"+"</td>");
	out.print("<td>"+"班级"+"</td>");
	out.print("<td>"+"身份证号"+"</td>");
	out.print("<td>"+"密码"+"</td>");
	out.print("<td>"+"电话"+"</td>");
	out.print("</tr>");				
	int totalRecord=StudentsInformationDao.queryRecordCount();
	if(session.getAttribute("session_allStudents")!=null){
	String [][]allStudents=(String[][])session.getAttribute("session_allStudents");
	for(int i=0;i<totalRecord;i++){
		out.print("<tr>");
		out.print("<td>"+allStudents[i][0].toString()+"</td>");
		out.print("<td>"+allStudents[i][1].toString()+"</td>");
		out.print("<td>"+allStudents[i][2].toString()+"</td>");
		out.print("<td>"+allStudents[i][3].toString()+"</td>");
		out.print("<td>"+allStudents[i][4].toString()+"</td>");
		out.print("<td>"+allStudents[i][5].toString()+"</td>");
		out.print("<td>"+allStudents[i][6].toString()+"</td>");
		out.print("<td>"+allStudents[i][7].toString()+"</td>");
		out.print("<td>"+allStudents[i][8].toString()+"</td>");		
		out.print("</tr>");
	}
	session.removeAttribute("session_allStudents");
	}
	out.print("</table>");
	out.print("</div>"); %> --%>
		<%-- <% 
/* out.print("<link href='css/administratorPage.css' rel='stylesheet' type='text/css'/>");
		out.print("<div class='header'><font size='6' color='#62A8EA'><br/>&emsp;&emsp;&emsp;后台管理</font></div>");
		out.print("<div class='body'>");
		out.print("<div class='body-left'>");
		out.print("<div class='leftMenu'>");
		out.print("<ul>");
		out.print("<li><a href='' style='text-decoration: none'><font size='5' color='blue'>用户信息管理</font></a>");
		out.print("<ul>");
		out.print("<li><a href='administratorPage.jsp?status=student' style='text-decoration: none'><font size='3' color='blue'>学生</font></a></li>");
		out.print("<li><a href='administratorPage.jsp?status=teacher' style='text-decoration: none'><font size='3' color='blue'>教师</font></a></li>");
		out.print("</ul>");
		out.print("</li>");
		out.print("</ul>");
		out.print("<ul>");
		out.print("<li><a href='' style='text-decoration: none;'><font size='5' color='blue'>资源管理</font></a>");
		out.print("<ul>");
		out.print("<li><a href='' style='text-decoration: none'><font size='3' color='blue'>精品课程</font></a></li>");
		out.print("<li><a href='' style='text-decoration: none'><font size='3' color='blue'>学习论坛</font></a></li>");
		out.print("</ul>");
		out.print("</li>");
		out.print("</ul>");
		out.print("</div>"); */
		
			
			
		/* request.getMethod().equalsIgnoreCase("post")	 */			
			/* String status="";
			status=request.getParameter("status");
			System.out.print(status); */
			if(request.getMethod().equalsIgnoreCase("student")){
				out.print("<div class='body-right'>");
				out.print("<table border='1'>");
				out.print("<tr>");
				out.print("<td>"+"学号"+"</td>");
				out.print("<td>"+"姓名"+"</td>");
				out.print("<td>"+"性别"+"</td>");
				out.print("<td>"+"学院"+"</td>");
				out.print("<td>"+"专业"+"</td>");
				out.print("<td>"+"班级"+"</td>");
				out.print("<td>"+"身份证号"+"</td>");
				out.print("<td>"+"密码"+"</td>");
				out.print("<td>"+"电话"+"</td>");
				out.print("</tr>");				
				int totalRecord=StudentsInformationDao.queryRecordCount();
				Object [][]allStudents=new Object[totalRecord][9];
				allStudents=StudentsInformationDao.showAllStudents();
				for(int i=0;i<totalRecord;i++){
					out.print("<tr>");
					out.print("<td>"+allStudents[i][0].toString()+"</td>");
					out.print("<td>"+allStudents[i][1].toString()+"</td>");
					out.print("<td>"+allStudents[i][2].toString()+"</td>");
					out.print("<td>"+allStudents[i][3].toString()+"</td>");
					out.print("<td>"+allStudents[i][4].toString()+"</td>");
					out.print("<td>"+allStudents[i][5].toString()+"</td>");
					out.print("<td>"+allStudents[i][6].toString()+"</td>");
					out.print("<td>"+allStudents[i][7].toString()+"</td>");
					out.print("<td>"+allStudents[i][8].toString()+"</td>");		
				}
				out.print("</table>");
				out.print("</div>");
			}
			/* }catch(Exception ex){
				ex.printStackTrace();
			} */
			/* out.print("</div>");
			out.print("</div>");	 */
			%> --%>
	</div>
	<div class="foot">
				<font color="white">Made by Aaron</font>		
		</div>
</body>
</html>